#include "product.h"

// 默认构造函数
Product::Product()
    : productId(0),
      purchasePrice(0.0),
      sellingPrice(0.0),
      categoryId(0),
      allowMemberDiscount(true)
{}

// 带参数的构造函数
Product::Product(int productId, const QString& productName, const QString& specification,
                 const QString& color, const QString& supplier, double purchasePrice,
                 double sellingPrice, int categoryId, bool allowMemberDiscount,
                 const QDateTime& createTime)
    : productId(productId),
      productName(productName),
      specification(specification),
      color(color),
      supplier(supplier),
      purchasePrice(purchasePrice),
      sellingPrice(sellingPrice),
      categoryId(categoryId),
      allowMemberDiscount(allowMemberDiscount),
      createTime(createTime)
{}

// Getter 方法实现
int Product::getProductId() const { return productId; }
QString Product::getProductName() const { return productName; }
QString Product::getSpecification() const { return specification; }
QString Product::getColor() const { return color; }
QString Product::getSupplier() const { return supplier; }
double Product::getPurchasePrice() const { return purchasePrice; }
double Product::getSellingPrice() const { return sellingPrice; }
int Product::getCategoryId() const { return categoryId; }
bool Product::getAllowMemberDiscount() const { return allowMemberDiscount; }
QDateTime Product::getCreateTime() const { return createTime; }

// Setter 方法实现
void Product::setProductId(int id) { productId = id; }
void Product::setProductName(const QString& name) { productName = name; }
void Product::setSpecification(const QString& spec) { specification = spec; }
void Product::setColor(const QString& c) { color = c; }
void Product::setSupplier(const QString& supp) { supplier = supp; }
void Product::setPurchasePrice(double price) { purchasePrice = price; }
void Product::setSellingPrice(double price) { sellingPrice = price; }
void Product::setCategoryId(int id) { categoryId = id; }
void Product::setAllowMemberDiscount(bool allow) { allowMemberDiscount = allow; }
void Product::setCreateTime(const QDateTime& time) { createTime = time; }
